🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / service / src / commonMain / kotlin / org / meshtastic / core / service / QueryControllerImpl.kt
Displaying Raw • Download
core/service/src/commonMain/kotlin/org/meshtastic/core/service/QueryControllerImpl.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 3.05 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.service
Tff7b72import T7ee787org.meshtastic.core.model.Position
Tff7b72import T7ee787org.meshtastic.core.repository.CommandSender
Tff7b72import T7ee787org.meshtastic.core.repository.NodeManager
Tff7b72import T7ee787org.meshtastic.core.repository.QueryController
Tff7b72import T7ee787org.meshtastic.core.repository.UiPrefs
Tff7b72import T7ee787org.meshtastic.proto.AdminMessage
T8b949e/**
* [QueryController] implementation: position, traceroute, telemetry, user info, and metadata "pull" queries.
*
* Focused collaborator of [RadioControllerImpl]. Mirrors the SDK's `TelemetryApi`/`RoutingApi` surface.
*/
Tff7b72internal Tff7b72class T56d364QueryControllerImplTb4b4b4(
Tff7b72private Tff7b72val Te6edf3commandSenderTb4b4b4: Te6edf3CommandSenderTb4b4b4,
Tff7b72private Tff7b72val Te6edf3nodeManagerTb4b4b4: Te6edf3NodeManagerTb4b4b4,
Tff7b72private Tff7b72val Te6edf3uiPrefsTb4b4b4: Te6edf3UiPrefsTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3QueryController Tb4b4b4{
Tff7b72private Tff7b72val Te6edf3myNodeNumTb4b4b4: Tffa657Int
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3nodeManagerTb4b4b4.Te6edf3myNodeNumTb4b4b4.Te6edf3value Tff7b72?: T79c0ff0
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrefreshMetadataTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Te6edf3commandSenderTb4b4b4.Te6edf3sendAdminTb4b4b4(Te6edf3destNumTb4b4b4, Te6edf3wantResponse Tff7b72= Tff7b72trueTb4b4b4) Tb4b4b4{ Te6edf3AdminMessageTb4b4b4(Te6edf3get_device_metadata_request Tff7b72= Tff7b72trueTb4b4b4) Tb4b4b4}
Tb4b4b4}
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrequestPositionTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3currentPositionTb4b4b4: Te6edf3PositionTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3destNum Tff7b72=Tff7b72= Te6edf3nodeManagerTb4b4b4.Te6edf3myNodeNumTb4b4b4.Te6edf3valueTb4b4b4) Tff7b72return
Tff7b72val Te6edf3provideLocation Tff7b72= Te6edf3uiPrefsTb4b4b4.Te6edf3shouldProvideNodeLocationTb4b4b4(Te6edf3myNodeNumTb4b4b4)Tb4b4b4.Te6edf3value
T8b949e// Position(0.0, 0.0, 0) is the protocol-level "no position" sentinel.
Tff7b72val Te6edf3resolvedPosition Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3provideLocationTb4b4b4) Tb4b4b4{
Te6edf3currentPositionTb4b4b4.Te6edf3takeIf Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3isValidTb4b4b4(Tb4b4b4) Tb4b4b4}
Tff7b72?: Te6edf3nodeManagerTb4b4b4.Te6edf3nodeDBbyNodeNumTff7b72[Te6edf3myNodeNumTff7b72]Tff7b72?.Te6edf3positionTff7b72?.Te6edf3let Tb4b4b4{ Te6edf3PositionTb4b4b4(Tffa657itTb4b4b4) Tb4b4b4}Tff7b72?.Te6edf3takeIf Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3isValidTb4b4b4(Tb4b4b4) Tb4b4b4}
Tff7b72?: Te6edf3PositionTb4b4b4(T79c0ff0.0Tb4b4b4, T79c0ff0.0Tb4b4b4, T79c0ff0Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3PositionTb4b4b4(T79c0ff0.0Tb4b4b4, T79c0ff0.0Tb4b4b4, T79c0ff0Tb4b4b4)
Tb4b4b4}
Te6edf3commandSenderTb4b4b4.Te6edf3requestPositionTb4b4b4(Te6edf3destNumTb4b4b4, Te6edf3resolvedPositionTb4b4b4)
Tb4b4b4}
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrequestUserInfoTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3destNum Tff7b72!Tff7b72= Te6edf3nodeManagerTb4b4b4.Te6edf3myNodeNumTb4b4b4.Te6edf3valueTb4b4b4) Tb4b4b4{
Te6edf3commandSenderTb4b4b4.Te6edf3requestUserInfoTb4b4b4(Te6edf3destNumTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrequestTracerouteTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Te6edf3commandSenderTb4b4b4.Te6edf3requestTracerouteTb4b4b4(Te6edf3requestIdTb4b4b4, Te6edf3destNumTb4b4b4)
Tb4b4b4}
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrequestTelemetryTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3typeValueTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Te6edf3commandSenderTb4b4b4.Te6edf3requestTelemetryTb4b4b4(Te6edf3requestIdTb4b4b4, Te6edf3destNumTb4b4b4, Te6edf3typeValueTb4b4b4)
Tb4b4b4}
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffrequestNeighborInfoTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Te6edf3commandSenderTb4b4b4.Te6edf3requestNeighborInfoTb4b4b4(Te6edf3requestIdTb4b4b4, Te6edf3destNumTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.08s